﻿YZView = function () {
    Sim.App.call(this);

};

YZView.prototype = new Sim.App();

YZView.prototype.init = function (param) {
    Sim.App.prototype.init.call(this, param);
    var effectController = param.effectController;
    this.renderer.setClearColor(getThreeColor(effectController.投影上背景));
    this.camera.position.set(0, 0, 1000);
    this.controls = new THREE.TrackballControls(this.camera, this.renderer.domElement);
};

YZView.prototype.show = function (groupPoints) {
    YZView.Geometries = [];
    this.doDispose(this.axis);
    var xy = new THREE.Vector3(0, 1, 1);
    this.axis = this.createXYZ2D(xy, groupPoints, extremeVs);
    this.addObject(this.axis);
};

YZView.prototype.createXYZ2D = function (xyz, groupPoints, extremeVs) {
    var maxV = new THREE.Vector3(-1000, -1000, -1000);
    var minV = new THREE.Vector3(1000, 1000, 1000);
    for (var i = 0; i < extremeVs.length; i++) {
        maxV.max(extremeVs[i].max);
        minV.min(extremeVs[i].min);
    }

    minV.multiply(xyz);
    maxV.multiply(xyz);
    var axis = new Axis2D();
    axis.init(groupPoints, maxV, minV, YZView.STEP, effectController, xyz, YZView.Geometries);
    return axis;
};

YZView.prototype.update = function () {
    Sim.App.prototype.update.call(this);

    this.controls.update();
};

//步履,每10作为坐标轴的1.
YZView.STEP = 10;

YZView.Geometries = [];